package xw.qxypt.modules.baseinfo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import xw.qxypt.common.utils.R;
import xw.qxypt.modules.baseinfo.entity.LhpAlertEntity;
import xw.qxypt.modules.baseinfo.entity.MapPloylineModel;
import xw.qxypt.modules.baseinfo.service.HomepageService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("homepage")
public class HomepageController {
    @Autowired
    private HomepageService homepageService;
    /*
    * 根据用户查询报警信息
    * */
    @RequestMapping("/showAlertByUser")
    public R showAlertByUser() {
       Map infoMap = homepageService.showAlertByUser();
        return R.ok().put("infoMap",infoMap);
    }
    /*
     * 根据用户和报警类型查询报警信息
     * */
    @RequestMapping("/showAlertByUserAndElement")
    public R showAlertByUserAndElement(@RequestParam Map<String, Object> params) {
        List<LhpAlertEntity> list = homepageService.showAlertByUserAndElement(params);
        return R.ok().put("list",list);
    }
    /*
     * 根据用户查询报警信息
     * */
    @RequestMapping("/checkEquipmengStatus")
    public R checkEquipmengStatus() {
        Map<String,Integer> infoMap = homepageService.checkEquipmengStatus();
        return R.ok().put("infoMap",infoMap);
    }
    /*
     * 根据坐标查询实时天气
     * */
    @RequestMapping("/getMarkerWeather")
    public R getMarkerWeather(HttpServletRequest request) {
        List list= homepageService.getMarkerWeather(request);
        return R.ok().put("list",list);
    }

    /*
     * 根据用户查询路网数据
     * */
    @RequestMapping("/getRoadLines")
    public List<MapPloylineModel> getRoadLines() {
        List<MapPloylineModel> ploylineList =homepageService.getRoadLines();
        return ploylineList;
    }
}
